package com.ykt.model;

import com.jfinal.plugin.activerecord.Page;

import java.util.Map;

public class MarketCategory extends BaseModel<MarketCategory> {
	private static final long serialVersionUID = 1L;

    public static final String market_id = "market_id";
    public static final String category_id = "category_id";

    public static final MarketCategory dao = new MarketCategory();

    public Page<MarketCategory> pageFindModel(int pageNumber, int rows, Map<String, String> paramMap) {
        String select = "SELECT c.*, m.name mname ";
        String sqlExceptSelect = " FROM category c "
        		+ " LEFT JOIN market_category mc ON c.id = mc.category_id "
        		+ " LEFT JOIN market m ON m.id = mc.market_id ";
        
        String sqlOrderBy = " ORDER BY m.id ";
        paramMap.put(OB, sqlOrderBy);

        return this.pageFindModel(select, sqlExceptSelect, pageNumber, rows, paramMap);
    }

}
